import { createRouter ,createWebHistory } from 'vue-router'
// import { createWebHashHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import BigScreenView from '../views/BigScreenView.vue'

//createRouter创建路由对象--这里的vue router是4版本,vue2是3版本.
const router = createRouter({
  //网址https://router.vuejs.org/zh/api/#Functions-createWebHistory
  //路由模式
//1.hash模式--是下面的函数生成的
// history:createWebHashHistory()
//2.history模式--是createWebHistory()
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      redirect: '/big-screen',
      component: HomeView,
    },
    {
      path: '/big-screen',
      name: 'big-screen',
      component: BigScreenView
    }
  ],
})

//导出路由对象,然后在main.js里面引入,注册到vue实例中
export default router
